package com.fruit.service.goods.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fruit.mapper.goods.BaseMapper;
import com.fruit.pojo.goods.Base;
import com.fruit.service.goods.BaseManager;
import lombok.extern.slf4j.Slf4j;

/**
 * 
 * @ClassName: BaseService
 * @author 葛欢欢
 * @version 2017.11.30 16:40
 */
@Slf4j
@Service
public class BaseService implements BaseManager {

	@Autowired
	private BaseMapper baseMapper;

	/**
	 * 获取基地信息
	 * 
	 * @author 葛欢欢
	 * @version 2017.11.30 16:40
	 * @return List<Base>
	 */
	@Override
	public List<Base> getBaseInfo() {
		return baseMapper.getBaseInfo();
	}

	/**
	 * 修改基地信息
	 * @author 葛欢欢
	 * @version 2017.11.30 16:40
	 * @param base
	 *            base
	 * @return int
	 */
	@Override
	public int updateBase(Base base) {
		log.info("【修改基地信息service】---【开始】---");
		log.info("【修改基地信息service传入的参数base：】 " + base);
		int wid = baseMapper.getWeatherCon(base.getWeatherType());
		if (wid > 0) {
			base.setWeatherConfigId(Integer.toString(wid));
		}
		return baseMapper.updateBase(base);
	}

}
